package com.maimao.model.kill;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;

@AllArgsConstructor
@NoArgsConstructor
@Setter
@Getter
@Builder
@TableName("mm_schedule")
public class Schedule implements Serializable {

    private static final long serialVersionUID = -8697692624093775582L;

    /**
     * 排期id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 活动id
     */
    @TableField("activity_id")
    private Integer activityId;

    /**
     * 活动名称
     */
    @TableField(exist = false)
    private String activityName;

    /**
     * 开始时间
     */
    @TableField("start_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @TableField("end_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    /**
     * 最大可用数量(当前排期允许的参与者数量)
     */
    @TableField("max_count")
    private Integer maxCount;

    /**
     * 1 手动添加 2 分布式任务定时添加
     */
    @TableField("`by`")
    private Integer by;

    /**
     * 已占用数量
     */
    @TableField("used_count")
    private Integer usedCount;

    /**
     * 1 启用 0 停止
     */
    @TableField("`enabled`")
    private Integer enabled;

    @Override
    public String toString() {
        return "Schedule{" +
                "id=" + id +
                ", activityId=" + activityId +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                ", maxCount=" + maxCount +
                ", by=" + by +
                ", usedCount=" + usedCount +
                ", enabled=" + enabled +
                '}';
    }
}